import Vue from 'vue';
import { Toast, Dialog, Swipe, SwipeItem } from 'vant';
import VueResize from 'vue-resize';
import DzDialog from '@/components/common/dz-dialog';
import DzSection from '@/components/common/dz-section';
import DzPageHeader from '@/components/common/dz-page-header';
import DzSwipe from '@/components/common/dz-swipe';
import DzSolutionItem from '@/components/common/dz-solution-item';
import App from '@/app.vue';
import { router } from '@/router';
import store from '@/store';
import * as $const from '@/common/const';
import EventEmitter from '@/utils/event-bus';
import FastClick from 'fastclick';
import 'vue-resize/dist/vue-resize.css';

FastClick.attach(document.body);

Vue.use(Toast).use(Dialog).use(Swipe).use(SwipeItem).use(VueResize);

const components = {
  DzDialog,
  DzSection,
  DzPageHeader,
  DzSwipe,
  DzSolutionItem,
};

Object.keys(components).forEach((key) => {
  // 全局注册组件
  Vue.component(key, components[key]);
});

Vue.config.productionTip = false;
Vue.prototype.$const = $const;
Vue.prototype.$eventbus = new EventEmitter();

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
